package com.api.shopapi.mapper;

import com.api.shopapi.entity.NursingSchedulingNighttime;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface NursingSchedulingNighttimeMapper {

    @Insert("insert into  nursing_scheduling_nighttime " +
            "(NursingSchedulingNighttimeCode,NursingSchedulingCode) " +
            "values (#{nursingSchedulingNighttime.NursingSchedulingNighttimeCode} ,#{nursingSchedulingNighttime.NursingSchedulingCode} )")
    int insert(@Param("nursingSchedulingNighttime") NursingSchedulingNighttime nursingSchedulingNighttime);

    @Update("update nursing_scheduling_nighttime set NursingSchedulingCode=#{nursingSchedulingNighttime.NursingSchedulingCode} where NursingSchedulingNighttimeCode=#{nursingSchedulingNighttime.NursingSchedulingNighttimeCode}   ")
    int updateByNursingSchedulingNighttimeCode(@Param("nursingSchedulingNighttime") NursingSchedulingNighttime nursingSchedulingNighttime);

    @Delete("delete from nursing_scheduling_nighttime where nursingSchedulingNighttimeCode=#{nursingSchedulingNighttimeCode} ")
    int deleteByNursingSchedulingNighttimeCode(@Param("nursingSchedulingNighttimeCode")String nursingSchedulingNighttimeCode);

    @Select("select * from nursing_scheduling_nighttime where NursingSchedulingNighttimeCode=#{nursingSchedulingNighttimeCode} order by Time desc")
    List<NursingSchedulingNighttime> getListByNursingSchedulingNightTimeCode(@Param("nursingSchedulingNighttimeCode")String nursingSchedulingNighttimeCode);

    @Select("select * from nursing_scheduling_nighttime where NursingSchedulingCode=#{nursingSchedulingCode} limit 1")
    NursingSchedulingNighttime getByNursingSchedulingCode(@Param("nursingSchedulingCode")String nursingSchedulingCode);
}
